package org.edu.modules.sxjy.controller;

import com.github.xiaoymin.knife4j.annotations.ApiSort;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Objects;
import java.util.Set;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.subject.Subject;
import org.edu.common.api.vo.Result;
import org.edu.common.aspect.annotation.AutoLog;
import org.edu.common.system.vo.LoginUser;
import org.edu.modules.sxjy.entity.SysLog;
import org.edu.modules.sxjy.entity.VeBaseCompanyFiling;
import org.edu.modules.sxjy.entity.VeBaseCompanyRecruit;
import org.edu.modules.sxjy.entity.VeBaseStudent;
import org.edu.modules.sxjy.entity.VeCommon;
import org.edu.modules.sxjy.entity.VeCompanyUser;
import org.edu.modules.sxjy.entity.VeDgsxResidentTeacher;
import org.edu.modules.sxjy.entity.VePractice;
import org.edu.modules.sxjy.feign.VeCommonClient;
import org.edu.modules.sxjy.service.IVeBaseCompanyFilingService;
import org.edu.modules.sxjy.service.IVeBaseCompanyRecruitService;
import org.edu.modules.sxjy.service.IVeCompanyService;
import org.edu.modules.sxjy.service.IVeCompanyUserService;
import org.edu.modules.sxjy.service.IVeDgsxResidentTeacherService;
import org.edu.modules.sxjy.service.IVePracticeService;
import org.edu.modules.sxjy.utils.PageResponseResult;
import org.jeecgframework.poi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.entity.ImportParams;
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import org.springframework.web.servlet.ModelAndView;

@Api(tags={"企业备案招聘"})
@RestController
@RequestMapping({"/sxjy/veBaseCompany"})
@ApiSort(60)
public class VeBaseCompanyController
{
    private static final Logger log = LoggerFactory.getLogger(VeBaseCompanyController.class);
    @Autowired
    private IVeBaseCompanyFilingService veBaseCompanyFilingService;
    @Autowired
    private IVeBaseCompanyRecruitService veBaseCompanyRecruitService;
    @Autowired
    private IVeDgsxResidentTeacherService veDgsxResidentTeacherService;
    @Autowired
    private IVeCompanyService veCompanyService;
    @Autowired
    private VeCommonClient veCommonClient;
    @Autowired
    private IVePracticeService vePracticeService;
    @Autowired
    private IVeCompanyUserService veCompanyUserService;

    @AutoLog("查询分页列表-企业备案信息")
    @ApiOperation(value="查询分页列表-企业备案信息", notes="查询分页列表-企业备案信息")
    @GetMapping({"/selectCompanyFilingPageList"})
    public PageResponseResult selectCompanyFilingPageList(VeBaseCompanyFiling veBaseCompanyFiling, @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, VeCommon veCommon)
    {
        Integer startLine = Integer.valueOf((pageNo.intValue() - 1) * pageSize.intValue());
        List<Map<String, Object>> list = this.veBaseCompanyFilingService.selectPageList(veBaseCompanyFiling, startLine, pageSize, veCommon);
        if ((Objects.isNull(list)) && (list.size() <= 0)) {
            return new PageResponseResult(Integer.valueOf(1), 1, 0, Result.error("未找到对应数据"));
        }
        int total = this.veBaseCompanyFilingService.getSumPage(veBaseCompanyFiling, veCommon);
        double totals = total;
        double pageSizes = pageSize.intValue();
        double totalPage = Math.ceil(totals / pageSizes);
        return new PageResponseResult(pageNo, (int)totalPage, total, Result.OK(list));
    }

    @AutoLog("查询分页列表-企业招聘信息")
    @ApiOperation(value="查询分页列表-企业招聘信息", notes="查询分页列表-企业招聘信息")
    @GetMapping({"/selectCompanyRecruitPageList"})
    public PageResponseResult selectCompanyRecruitPageList(VeBaseCompanyRecruit veBaseCompanyRecruit, @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, VeCommon veCommon)
    {
        Integer startLine = Integer.valueOf((pageNo.intValue() - 1) * pageSize.intValue());
        List<Map<String, Object>> list = this.veBaseCompanyRecruitService.selectPageList(veBaseCompanyRecruit, startLine, pageSize, veCommon);
        if ((Objects.isNull(list)) && (list.size() <= 0)) {
            return new PageResponseResult(Integer.valueOf(1), 1, 0, Result.error("未找到对应数据"));
        }
        int total = this.veBaseCompanyRecruitService.getSumPage(veBaseCompanyRecruit, veCommon);
        double totals = total;
        double pageSizes = pageSize.intValue();
        double totalPage = Math.ceil(totals / pageSizes);
        return new PageResponseResult(pageNo, (int)totalPage, total, Result.OK(list));
    }

    @AutoLog("查询分页列表-驻点教师信息")
    @ApiOperation(value="查询分页列表-驻点教师信息", notes="查询分页列表-驻点教师信息")
    @GetMapping({"/selectResidentTeacherPageList"})
    public PageResponseResult selectResidentTeacherPageList(VeDgsxResidentTeacher veDgsxResidentTeacher, @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, VeCommon veCommon)
    {
        Integer startLine = Integer.valueOf((pageNo.intValue() - 1) * pageSize.intValue());
        List<Map<String, Object>> list = this.veDgsxResidentTeacherService.selectPageList(veDgsxResidentTeacher, startLine, pageSize, veCommon);
        if ((Objects.isNull(list)) && (list.size() <= 0)) {
            return new PageResponseResult(Integer.valueOf(1), 1, 0, Result.error("未找到对应数据"));
        }
        int total = this.veDgsxResidentTeacherService.getSumPage(veDgsxResidentTeacher, veCommon);
        double totals = total;
        double pageSizes = pageSize.intValue();
        double totalPage = Math.ceil(totals / pageSizes);
        return new PageResponseResult(pageNo, (int)totalPage, total, Result.OK(list));
    }

    @AutoLog("查询分页列表-实习学生信息")
    @ApiOperation(value="查询分页列表-实习学生信息", notes="查询分页列表-实习学生信息")
    @GetMapping({"/selectCompanyStudentPageList"})
    public Result<?> selectCompanyStudentPageList(VeBaseStudent veBaseStudent, @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, VeCommon veCommon)
    {
        StringBuilder stringBuilder = new StringBuilder();

        List<VePractice> list = new ArrayList();
        Map map;
        if (veCommon.getUserType().contains("3"))
        {
            map = this.veCompanyService.getCompanyByUserId(veCommon.getUserId());
            if ((map == null) || (map.size() == 0)) {
                return Result.error("暂无学生! ");
            }
            list = this.vePracticeService.getPracticeListByCpId(Integer.valueOf(Integer.parseInt(map.get("id").toString())));
        }
        else
        {
            list = this.vePracticeService.getPracticeListByCpId(null);
        }
        for (VePractice vePractice : list) {
            stringBuilder.append(vePractice.getStuUserId() + ",");
        }
        Result result = this.veCommonClient.getStudentPageListBySearch("09d5e1e7f9b049008eee645c783a1d67", veBaseStudent.getXh(), veBaseStudent
                .getXm(), veBaseStudent.getSfzh(), veBaseStudent.getFalId(), veBaseStudent.getSpecId(), veBaseStudent
                .getGradeId(), veBaseStudent.getBjId(), stringBuilder.toString(), Integer.valueOf(1), pageNo, pageSize);
        return result;
    }

    @AutoLog("查询分页列表-操作日志")
    @ApiOperation(value="查询分页列表-操作日志", notes="查询分页列表-操作日志")
    @GetMapping({"/selectSysLogPageList"})
    public Result<?> selectSysLogPageList(SysLog sysLog, @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, @RequestParam(name="pageSize", defaultValue="10") Integer pageSize)
    {
        sysLog.setNum(Integer.valueOf(3));
        return this.veCommonClient.querySysLogPageList(sysLog, pageNo, pageSize);
    }

    @AutoLog("根据userId获取企业信息")
    @ApiOperation(value="根据userId获取企业信息", notes="根据userId获取企业信息")
    @GetMapping({"/getCompanyByUserId"})
    public Result getCompanyByUserId(@RequestParam(name="userId", required=true) String userId)
    {
        Map companyByUserId = this.veCompanyService.getCompanyByUserId(userId);
        return Result.OK(companyByUserId);
    }

    @AutoLog("根据userId判断备案是否可新增")
    @ApiOperation(value="根据userId判断备案是否可新增", notes="根据userId判断备案是否可新增")
    @GetMapping({"/getCompanyFilingJudgeByUserId"})
    public Result getCompanyFilingJudgeByUserId(@RequestParam(name="userId", required=true) String userId)
    {
        Map map = this.veCompanyService.getCompanyByUserId(userId);
        if ((map == null) || (map.size() == 0) || ("".equals(map.get("id")))) {
            return Result.error("暂无企业信息! ");
        }
        VeBaseCompanyFiling notCheckModel = this.veBaseCompanyFilingService.getNotCheckCompanyFilingByCpId(Integer.valueOf(Integer.parseInt(map.get("id").toString())));
        if (notCheckModel != null) {
            return Result.OK(Boolean.valueOf(false));
        }
        VeBaseCompanyFiling checkModel = this.veBaseCompanyFilingService.getCheckCompanyFilingByCpId(Integer.valueOf(Integer.parseInt(map.get("id").toString())));
        if (checkModel != null) {
            return Result.OK(Boolean.valueOf(false));
        }
        return Result.OK(Boolean.valueOf(true));
    }

    @AutoLog("根据userId判断招聘是否可新增")
    @ApiOperation(value="根据userId判断招聘是否可新增", notes="根据userId判断招聘是否可新增")
    @GetMapping({"/getCompanyRecruitJudgeByUserId"})
    public Result getCompanyRecruitJudgeByUserId(@RequestParam(name="userId", required=true) String userId)
    {
        Map map = this.veCompanyService.getCompanyByUserId(userId);
        if ((map == null) || (map.size() == 0) || ("".equals(map.get("id")))) {
            return Result.error("暂无企业信息! ");
        }
        VeBaseCompanyFiling checkModel = this.veBaseCompanyFilingService.getCheckCompanyFilingByCpId(Integer.valueOf(Integer.parseInt(map.get("id").toString())));
        if (checkModel != null) {
            return Result.OK(Boolean.valueOf(true));
        }
        return Result.OK(Boolean.valueOf(false));
    }

    @AutoLog("新增-企业备案信息")
    @ApiOperation(value="新增-企业备案信息", notes="新增-企业备案信息")
    @PostMapping({"/addCompanyFiling"})
    public Result<?> addCompanyFiling(@RequestBody VeBaseCompanyFiling veBaseCompanyFiling)
    {
        if (veBaseCompanyFiling.getCpId() == null) {
            return Result.error("企业为空不能添加! ");
        }
        VeBaseCompanyFiling notCheckModel = this.veBaseCompanyFilingService.getNotCheckCompanyFilingByCpId(veBaseCompanyFiling.getCpId());
        if (notCheckModel != null) {
            return Result.error("企业已存在待审核的备案! ");
        }
        VeBaseCompanyFiling checkModel = this.veBaseCompanyFilingService.getCheckCompanyFilingByCpId(veBaseCompanyFiling.getCpId());
        if (checkModel != null) {
            return Result.error("企业已存在审核通过的备案! ");
        }
        veBaseCompanyFiling.setFilingStatus(Integer.valueOf(0));
        Long times = Long.valueOf(System.currentTimeMillis() / 1000L);
        veBaseCompanyFiling.setCreateTime(Integer.valueOf(times.intValue()));
        this.veBaseCompanyFilingService.save(veBaseCompanyFiling);
        return Result.ok("添加成功! ");
    }

    @AutoLog("新增-企业招聘信息")
    @ApiOperation(value="新增-企业招聘信息", notes="新增-企业招聘信息")
    @PostMapping({"/addCompanyRecruit"})
    public Result<?> addCompanyRecruit(@RequestBody VeBaseCompanyRecruit veBaseCompanyRecruit)
    {
        if (veBaseCompanyRecruit.getCpId() == null) {
            return Result.error("企业不存在! ");
        }
        List<VeBaseCompanyFiling> modelList = this.veBaseCompanyFilingService.getCompanyFilingByCpId(veBaseCompanyRecruit.getCpId());
        if (modelList.size() == 0) {
            return Result.error("请先添加企业备案信息! ");
        }
        VeBaseCompanyFiling notCheckModel = this.veBaseCompanyFilingService.getNotCheckCompanyFilingByCpId(veBaseCompanyRecruit.getCpId());
        if (notCheckModel != null) {
            return Result.error("企业备案审核中不能添加! ");
        }
        VeBaseCompanyFiling checkModel = this.veBaseCompanyFilingService.getCheckCompanyFilingByCpId(veBaseCompanyRecruit.getCpId());
        if (checkModel == null)
        {
            int num = this.veBaseCompanyFilingService.getRejectCompanyFilingByCpId(veBaseCompanyRecruit.getCpId());
            if (num > 0) {
                return Result.error("企业备案暂未审核通过不能添加! ");
            }
        }
        VeCompanyUser veCompanyUser = this.veCompanyUserService.getCpInfoByUserId(veBaseCompanyRecruit.getUserId());
        if (veCompanyUser != null) {
            veBaseCompanyRecruit.setApplyUserId(Integer.valueOf(veCompanyUser.getId()));
        }
        Long times = Long.valueOf(System.currentTimeMillis() / 1000L);
        veBaseCompanyRecruit.setApplyTime(Integer.valueOf(times.intValue()));
        veBaseCompanyRecruit.setApplyStatus(Integer.valueOf(0));

        this.veBaseCompanyRecruitService.save(veBaseCompanyRecruit);
        return Result.ok("添加成功! ");
    }

    @AutoLog("新增-驻点教师信息")
    @ApiOperation(value="新增-驻点教师信息", notes="新增-驻点教师信息")
    @PostMapping({"/addResidentTeacher"})
    public Result<?> addResidentTeacher(@RequestBody VeDgsxResidentTeacher veDgsxResidentTeacher)
    {
        if (veDgsxResidentTeacher.getCpId() == null) {
            return Result.error("企业为空不能添加! ");
        }
        this.veDgsxResidentTeacherService.save(veDgsxResidentTeacher);
        return Result.ok("添加成功! ");
    }

    @AutoLog("编辑-企业备案信息")
    @ApiOperation(value="编辑-企业备案信息", notes="编辑-企业备案信息")
    @PutMapping({"/editCompanyFiling"})
    public Result<?> editCompanyFiling(@RequestBody VeBaseCompanyFiling veBaseCompanyFiling)
    {
        if (veBaseCompanyFiling.getCpId() == null) {
            return Result.error("企业为空不能编辑! ");
        }
        this.veBaseCompanyFilingService.updateById(veBaseCompanyFiling);
        return Result.ok("编辑成功! ");
    }

    @AutoLog("编辑-企业招聘信息")
    @ApiOperation(value="编辑-企业招聘信息", notes="编辑-企业招聘信息")
    @PutMapping({"/editCompanyRecruit"})
    public Result<?> editCompanyRecruit(@RequestBody VeBaseCompanyRecruit veBaseCompanyRecruit)
    {
        if (veBaseCompanyRecruit.getCpId() == null) {
            return Result.error("企业为空不能编辑! ");
        }
        veBaseCompanyRecruit.setApplyStatus(Integer.valueOf(0));

        this.veBaseCompanyRecruitService.save(veBaseCompanyRecruit);
        return Result.ok("编辑成功! ");
    }

    @AutoLog("编辑-驻点教师信息")
    @ApiOperation(value="编辑-驻点教师信息", notes="编辑-驻点教师信息")
    @PutMapping({"/editResidentTeacher"})
    public Result<?> editResidentTeacher(@RequestBody VeDgsxResidentTeacher veDgsxResidentTeacher)
    {
        if (veDgsxResidentTeacher.getCpId() == null) {
            return Result.error("企业为空不能编辑! ");
        }
        this.veDgsxResidentTeacherService.updateById(veDgsxResidentTeacher);
        return Result.ok("编辑成功! ");
    }

    @AutoLog("审核-企业备案信息")
    @ApiOperation(value="审核-企业备案信息", notes="审核-企业备案信息")
    @PutMapping({"/checkCompanyFiling"})
    public Result<?> checkCompanyFiling(@RequestBody VeBaseCompanyFiling veBaseCompanyFiling)
    {
        VeBaseCompanyFiling model = (VeBaseCompanyFiling)this.veBaseCompanyFilingService.getById(veBaseCompanyFiling.getId());
        if (model == null) {
            return Result.error("审核失败! ");
        }
        model.setFilingStatus(veBaseCompanyFiling.getFilingStatus());
        model.setOpinion(veBaseCompanyFiling.getOpinion());
        this.veBaseCompanyFilingService.updateById(model);
        return Result.ok("审核成功! ");
    }

    @AutoLog("审核-企业招聘信息")
    @ApiOperation(value="审核-企业招聘信息", notes="审核-企业招聘信息")
    @PutMapping({"/checkCompanyRecruit"})
    public Result<?> checkCompanyRecruit(@RequestBody VeBaseCompanyRecruit veBaseCompanyRecruit)
    {
        VeBaseCompanyRecruit model = (VeBaseCompanyRecruit)this.veBaseCompanyRecruitService.getById(veBaseCompanyRecruit.getId());
        if (model == null) {
            return Result.error("审核失败! ");
        }
        model.setApplyStatus(veBaseCompanyRecruit.getApplyStatus());
        model.setOpinion(veBaseCompanyRecruit.getOpinion());
        this.veBaseCompanyRecruitService.updateById(model);
        return Result.ok("审核成功! ");
    }

    @AutoLog("批量删除-企业备案信息")
    @ApiOperation(value="批量删除-企业备案信息", notes="批量删除-企业备案信息")
    @DeleteMapping({"/deleteCompanyFiling"})
    public Result<?> deleteCompanyFiling(@RequestParam(name="ids", required=true) String ids)
    {
        this.veBaseCompanyFilingService.removeByIds(Arrays.asList(ids.split(",")));
        return Result.ok("删除成功!");
    }

    @AutoLog("批量删除-企业招聘信息")
    @ApiOperation(value="批量删除-企业招聘信息", notes="批量删除-企业招聘信息")
    @DeleteMapping({"/deleteCompanyRecruit"})
    public Result<?> deleteCompanyRecruit(@RequestParam(name="ids", required=true) String ids)
    {
        this.veBaseCompanyRecruitService.removeByIds(Arrays.asList(ids.split(",")));
        return Result.ok("删除成功!");
    }

    @AutoLog("批量删除-驻点教师信息")
    @ApiOperation(value="批量删除-驻点教师信息", notes="批量删除-驻点教师信息")
    @DeleteMapping({"/deleteResidentTeacher"})
    public Result<?> deleteResidentTeacher(@RequestParam(name="ids", required=true) String ids)
    {
        this.veDgsxResidentTeacherService.removeByIds(Arrays.asList(ids.split(",")));
        return Result.ok("删除成功!");
    }

    @RequestMapping({"/exportXlsCompanyFiling"})
    public ModelAndView exportXlsCompanyFiling(VeBaseCompanyFiling veBaseCompanyFiling, HttpServletRequest request)
    {
        List<Map<String, Object>> list = this.veBaseCompanyFilingService.queryCompanyFilingList(veBaseCompanyFiling);

        ModelAndView modelAndView = new ModelAndView(new JeecgEntityExcelView());

        modelAndView.addObject("fileName", "企业备案信息列表");
        modelAndView.addObject("entity", VeBaseCompanyFiling.class);
        LoginUser user = (LoginUser)SecurityUtils.getSubject().getPrincipal();
        modelAndView.addObject("params", new ExportParams("企业备案信息列表", "导出人:" + user.getRealname(), "导出信息"));
        modelAndView.addObject("data", list);
        return modelAndView;
    }

    @RequestMapping({"/exportXlsCompanyRecruit"})
    public ModelAndView exportXlsCompanyRecruit(VeBaseCompanyRecruit veBaseCompanyRecruit, HttpServletRequest request)
    {
        List<Map<String, Object>> list = this.veBaseCompanyRecruitService.exportXlsCompanyRecruitList(veBaseCompanyRecruit);

        ModelAndView modelAndView = new ModelAndView(new JeecgEntityExcelView());

        modelAndView.addObject("fileName", "企业招聘信息列表");
        modelAndView.addObject("entity", VeBaseCompanyRecruit.class);
        LoginUser user = (LoginUser)SecurityUtils.getSubject().getPrincipal();
        modelAndView.addObject("params", new ExportParams("企业招聘信息列表", "导出人:" + user.getRealname(), "导出信息"));
        modelAndView.addObject("data", list);
        return modelAndView;
    }

    @ApiOperation(value="excel导入-企业备案信息列表", notes="excel导入-企业备案信息列表")
    @RequestMapping(value={"/importExcelCompanyFiling"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
    public Result<?> importExcelCompanyFiling(HttpServletRequest request, HttpServletResponse response)
    {
        MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest)request;
        Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
        Iterator localIterator = fileMap.entrySet().iterator();
        if (localIterator.hasNext())
        {
            Map.Entry<String, MultipartFile> entity = (Map.Entry)localIterator.next();
            MultipartFile file = (MultipartFile)entity.getValue();
            ImportParams params = new ImportParams();
            params.setTitleRows(1);
            params.setHeadRows(1);
            params.setNeedSave(true);
            try
            {
                int i = 0;
                //lbh 2024/07/31 sb >> StringBuilder sb
                StringBuilder sb = new StringBuilder();
                List<VeBaseCompanyFiling> veBaseCompanyFilings = ExcelImportUtil.importExcel(file.getInputStream(), VeBaseCompanyFiling.class, params);
                Object localObject1;
                if (veBaseCompanyFilings.size() > 0) {
                    for (localObject1 = veBaseCompanyFilings.iterator(); ((Iterator)localObject1).hasNext();)
                    {
                        VeBaseCompanyFiling veBaseCompanyFiling = (VeBaseCompanyFiling)((Iterator)localObject1).next();
                        this.veBaseCompanyFilingService.save(veBaseCompanyFiling);
                    }
                }
                if (i == 0)
                {
                    if (sb.length() > 0) {
                        sb.replace(sb.length() - 1, sb.length(), "!");
                    }
                    return Result.error("文件导入失败, 请检查导入数据是否正确! " + sb);
                }
                return Result.ok("文件导入成功！数据行数：" + i);
            }
            catch (Exception e)
            {
                StringBuilder sb;
                log.error(e.getMessage(), e);
                return Result.error("文件导入失败:" + e.getMessage());
            }
            finally
            {
                try
                {
                    file.getInputStream().close();
                }
                catch (IOException e)
                {
                    log.error(e.getMessage(), e);
                }
            }
        }
        return Result.error("文件导入失败！");
    }

    @ApiOperation(value="excel导入-企业招聘信息列表", notes="excel导入-企业招聘信息列表")
    @RequestMapping(value={"/importExcelCompanyRecruit"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
    public Result<?> importExcelCompanyRecruit(HttpServletRequest request, HttpServletResponse response)
    {
        MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest)request;
        Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
        Iterator localIterator = fileMap.entrySet().iterator();
        if (localIterator.hasNext())
        {
            Map.Entry<String, MultipartFile> entity = (Map.Entry)localIterator.next();
            MultipartFile file = (MultipartFile)entity.getValue();
            ImportParams params = new ImportParams();
            params.setTitleRows(1);
            params.setHeadRows(1);
            params.setNeedSave(true);
            try
            {
                int i = 0;
                //lbh 2024/07/31 sb >> StringBuilder sb
                StringBuilder sb = new StringBuilder();
                List<VeBaseCompanyRecruit> veBaseCompanyRecruits = ExcelImportUtil.importExcel(file.getInputStream(), VeBaseCompanyRecruit.class, params);
                Object localObject1;
                if (veBaseCompanyRecruits.size() > 0) {
                    for (localObject1 = veBaseCompanyRecruits.iterator(); ((Iterator)localObject1).hasNext();)
                    {
                        VeBaseCompanyRecruit veBaseCompanyRecruit = (VeBaseCompanyRecruit)((Iterator)localObject1).next();
                        this.veBaseCompanyRecruitService.save(veBaseCompanyRecruit);
                    }
                }
                if (i == 0)
                {

                    if (sb.length() > 0) {
                        sb.replace(sb.length() - 1, sb.length(), "!");
                    }
                    return Result.error("文件导入失败, 请检查导入数据是否正确! " + sb);
                }
                return Result.ok("文件导入成功！数据行数：" + i);
            }
            catch (Exception e)
            {
                StringBuilder sb;
                log.error(e.getMessage(), e);
                return Result.error("文件导入失败:" + e.getMessage());
            }
            finally
            {
                try
                {
                    file.getInputStream().close();
                }
                catch (IOException e)
                {
                    log.error(e.getMessage(), e);
                }
            }
        }
        return Result.error("文件导入失败！");
    }
}
